package com.xmsit.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xmsit.pojo.AdsConsumeStatLastMonth;
import com.xmsit.service.AdsConsumeStatLastMonthService;
import com.xmsit.mapper.AdsConsumeStatLastMonthMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

/**
* @author 徐
* @description 针对表【ads_consume_stat_last_month(能耗主题统计)】的数据库操作Service实现
* @createDate 2025-04-18 22:09:04
*/
@Service
public class AdsConsumeStatLastMonthServiceImpl extends ServiceImpl<AdsConsumeStatLastMonthMapper, AdsConsumeStatLastMonth>
    implements AdsConsumeStatLastMonthService{



    @Override
    public List<AdsConsumeStatLastMonth> getAdsConsumeStatLastMonth(AdsConsumeStatLastMonth adsConsumeStatLastMonth) {
        LambdaQueryWrapper<AdsConsumeStatLastMonth> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(AdsConsumeStatLastMonth::getVin, adsConsumeStatLastMonth.getVin());
        if(adsConsumeStatLastMonth.getMon() != null) {
            queryWrapper.eq(AdsConsumeStatLastMonth::getMon, adsConsumeStatLastMonth.getMon());
        }

        List<AdsConsumeStatLastMonth> adsConsumeStatLastMonths = list(queryWrapper);
        return adsConsumeStatLastMonths;
    }
}




